package com.bq.gametrade.view;

import android.content.Context;
import android.os.CountDownTimer;
import android.widget.TextView;

/**
 * Created by Fei on 2015/11/10.
 */
public class TimeButton extends CountDownTimer {

    private TextView button;

    public TimeButton(Context context, long millisInFuture, long countDownInterval, TextView button) {
        super(millisInFuture, countDownInterval);
        this.button=button;
    }

    @Override
    public void onTick(long millisUntilFinished) {
//        button.setBackgroundColor(Color.parseColor("#999999"));
        button.setClickable(false);
        button.setText(millisUntilFinished / 1000 + "s后重新获取");
    }

    @Override
    public void onFinish() {
        button.setText("获取验证码");
        button.setClickable(true);
//        button.setBackgroundColor(Color.parseColor("#ffc945"));
    }

}
